• File: hub_import_maintain.php
  • Full Path: C:/htdocs/reeft_gps_test/REEFTintegrationLog/saved/hub_import_maintain.php
  • Date Modified: 04/30/2025 7:56 AM
  • File size: 83.88 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?php
//======================================================================================
//
// Function: Maintain  HUB_IMPORT
//
// Programmer: JKJ
// Date      : 2024-08-30
//
// Copyright Reeft A/S (c) - 2024
//======================================================================================

//======================================================================================
// Get input
//======================================================================================

//======================================================================================
// Make line uppercase
//======================================================================================


//======================================================================================
// General config
//======================================================================================
	include "config/config.php";

//======================================================================================
// Check if user is logged in?
//======================================================================================
	include "login_check.php";

//======================================================================================
// Get session variables
//======================================================================================

	include "include/getsession.php";


	// include "include/uuid_create.php";
	// include "include/generate_password_md5.php";

//======================================================================================
// Set language
//======================================================================================

	include "include/set_language.php";

//======================================================================================
// Set defaults
//======================================================================================

	// $pk_reference  = $_SESSION['session_dft_pk_reference'];
	// $referenceCode = $_SESSION['session_dft_referencecode'];
	// $referenceName = $_SESSION['session_dft_referencename'];

//======================================================================================
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title><?php echo $datahub_text0001 ?></title>

	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<meta name="description" content="REEFTvisual - Stoptime">
    <meta name="author" content="REEFT A/S">
    <link rel="icon" href="images/favicon/favicon.ico">

    <!-- Bootstrap / jQuery -->
    <link href="css/bootstrap4.3.1/css/bootstrap.custom.min.css" rel="stylesheet">
    <link href="css/bootstrap4.3.1/css/themes/bootstrap.custom.min.css" rel="stylesheet">

	<link href="css/bootstrap4.3.1/css/normalize.css" rel="stylesheet" type="text/css">

	<link href="css/sticky-footer.css" rel="stylesheet" type="text/css">

    <!-- Custom styles for this template -->
    <link href="css/custom.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">


	<script src="css/fontawesome6.5.1/js/all.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-light.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-regular.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-solid.min.js"></script>
	<script src="css/fontawesome6.5.1/js/sharp-thin.min.js"></script>


	<link href="css/bootstrap_animation/css/animate4/animate.css" rel="stylesheet" type="text/css">

	<!--<link href="javascript/chosen/chosen.css" rel="stylesheet" type="text/css">-->

	<link href="javascript/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>

    <script src="javascript/jquery.js"></script>
    <script src="css/bootstrap4.3.1/js/popper.js"></script>
    <script src="css/bootstrap4.3.1/js/bootstrap.min.js"></script>

	<script src="javascript/jquery-ui/jquery-ui.min.js"></script>
    <script src="javascript/jquery.ui.touch-punch.min.js"></script>

	<link href="javascript/bgrins-spectrum/spectrum.css" rel="stylesheet" type="text/css">
	<script src="javascript/bgrins-spectrum/spectrum.js"></script>

	<script src="javascript/moment.min.js"></script>
	<script src="javascript/moment-with-locales.min.js"></script>
	<script src="javascript/moment-duration-format.min.js"></script>

	<script src="javascript/number_format/jquery.number.min.js"></script>

	<script src="javascript/jquery.scrollTo.min.js"></script>


	<!-- Data tables start -->
		<link href="javascript/datatables.3.12/datatables.min.css" rel="stylesheet">
		<script src="javascript/datatables.3.12/datatables.min.js"></script>
	<!-- Data tables end -->

	<script src="javascript/chosen/chosen.jquery.min.js" type="text/javascript"></script>

	<script src="javascript/viewer-master/dist/viewer.min.js"></script>
	<link  href="javascript/viewer-master/dist/viewer.min.css" rel="stylesheet">

	<script src="javascript/ajaxq/ajaxq.js"></script>

	<link id="scrollUpTheme" rel="stylesheet" href="javascript/scrollup-master/dist/css/themes/image.css">
	<script src="javascript/scrollup-master/dist/jquery.scrollUp.js"></script>
	<script src="javascript/shortcut.js"></script>

	<script src="javascript/_reeft_js/set_font_awesome_icon_type.js"></script>
	<script src="javascript/_reeft_js/date_convert.js"></script>
<style>


.modal-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto; }
	
.btn-custom-wide {
	height:60px;
	width:210px;
}

.text-truncate-dt {
    max-width: 450px;
	white-space: nowrap;
    overflow: hidden;
	text-overflow: ellipsis;

}

.text-align-dt {
    text-align: center;
}

.modal-xxl {
    max-width: 80%;
}

.modal-xl {
    max-width: 50%;
}


.border-3 {
    border-width:3px !important;
}

td .hover-img {
  position:relative;
 }
td .hover-img span {
  position:absolute; left:-9999px; top:-9999px; z-index:9999;
 }
td:hover .hover-img span {
  top: 5px;
  left:0px;
 }

 .chosen-container-single {
    min-width: 100%;
}

</style>

<script language="JavaScript">

//=============================================================================
// Globals
//=============================================================================

    var thisCurrentRow;
	var thisGlobalRowData;
    var thisGlobalTableData;

	var GLOBAL_CONFIG_TYPE_BUTTON_TEXT_A = 'Text/Char';
	var GLOBAL_CONFIG_TYPE_BUTTON_TEXT_N = 'Number/Value';
	var GLOBAL_CONFIG_TYPE_BUTTON_TEXT_L = 'Date (ISO)';
	var GLOBAL_CONFIG_TYPE_BUTTON_TEXT_T = 'Time (ISO)';

	var GLOBAL_CONFIG_RPYIFSPATH = '';
	var GLOBAL_CONFIG_RPYIFSLIBR = '';


	// Save field
	var save_IPFILENAME = '';
	var save_IPIMPSEQ 	= '';

	var global_debug = 'N';

	// Add allowed Y/N
	var GLOBAL_ADD_ALLOWED = 'Y';

	// Show group buttons
	var GLOBAL_SHOW_GROUP_BUTTONS = 'N';

	// Delete allowed Y/N
	var GLOBAL_DELETE_ALLOWED = 'Y';

	// sortMode
	var GLOBAL_SORTMODE = 'DESC';

	var jsonDataSave = {};

	var DFT_DATE_DISPLAY_FORMAT 	=  '<?php //echo $DFT_DATE_DISPLAY_FORMAT ?>';
	var DFT_LANGUAGE 				=  '<?php //echo $DFT_LANGUAGE ?>';

	var GLOBAL_TOTALPAGESSTOPVALUE	=  10;

	// Save field
	//var save_CFGNAM = '';


	$(function () {
	  $.scrollUp({
		scrollName: 'scrollUp', // Element ID
		//topDistance: '1800', // Distance from top before showing element (px)
		//topSpeed: 300, // Speed back to top (ms)
		scrollDistance: '300', // Distance from top before showing element (px)
		scrollSpeed: 300, // Speed back to top (ms)
		animation: 'fade', // Fade, slide, none
		animationInSpeed: 200, // Animation in speed (ms)
		animationOutSpeed: 200, // Animation out speed (ms)
		scrollText: false, //'Scroll to top', // Text for element
		activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF'
	  });
	});

//=============================================================================
// Get data
//=============================================================================
function getData( inputGetData )
{

	// Reset, show all
	if ( inputGetData == '*RESET' ) {
		inputGetData = '';

		//Clear search
		thisGlobalTableData.search( '' );

	}

	//Only initialize datatables once, else just draw it
	if ( $.fn.dataTable.isDataTable( '#REEFTvisual_data' ) ) {
		thisGlobalTableData.draw(); // fire in the hole
	}
	else {
		setDataTables();
	}

}

//=============================================================================
// Set datatables
//=============================================================================
function setDataTables()
{


	// Delete allowed?
	if ( GLOBAL_DELETE_ALLOWED == 'Y' ) {
		var show_the_delete_button = true;
	} else {
		var show_the_delete_button = false;
	}


    new $('#REEFTvisual_data').DataTable({
		"ajax": {
			"url": 'hub_import_maintain_get.php',
			"type": "POST",
			"data": function (parmData) {

				// Add custom parameters to the ajax call

				// Get the current date line
				input_IPFILENAME = $('#input-IPFILENAME').val();

				// Webservice name
				parmData.IPFILENAME	 = input_IPFILENAME;


			},
			dataSrc: function (jsonData) {  //return data

				var rpyCMPNO			= jsonData.header.rpyCMPNO;
				var rpyCMPNO_Name		= jsonData.header.rpyCMPNO_Name;
				var rpyFile_name		= jsonData.header.rpyFile_name
				var rpyFile_description	= jsonData.header.rpyFile_description
				var rpyTableRecordsFound= jsonData.header.rpyTableRecordsFound

				var returnCode 			= jsonData.header.returnCode;
				var returnMsg 			= jsonData.header.returnMsg;
				var entries_found 		= jsonData.header.entries_found;
				var response_sec 		= jsonData.header.response_sec;

				// Some default data
				GLOBAL_CONFIG_RPYIFSLIBR = jsonData.header.rpyDTAlibr;
				GLOBAL_CONFIG_RPYIFSPATH = jsonData.header.rpyIFSpath;

				// Show load time
				$('#text-total-records-found').html( rpyTableRecordsFound );
				$('#load-time-from-database').html('entries found: ' + entries_found + ' (' + response_sec + ')');

				// Set Company and file information
				if ( rpyFile_name != '' ) {
					$('#data-hub-company-information').html( '<span title="' + rpyFile_name + ' - ' + rpyFile_description + '">' + rpyCMPNO_Name + ' (' + rpyCMPNO + ')' + '</span>' ).css('font-size','1.3em');
				}

				// Init button line fields
				var HTMLlineButtons 		= '';
				var HTMLlineButtonsModal 	= '';
				var selectedButtonClass 	= 'btn-dark';

				//=====================================================================================
				// Create group buttons, only if wanted
				//=====================================================================================
				if ( GLOBAL_SHOW_GROUP_BUTTONS == 'Y' ) {

					$.each( jsonData.header_buttons, function( index, object ){
						var buttonLine   = object.buttonLine;
						var buttonCount	 = object.buttonCount;

						if ( input_IPFILENAME == buttonLine ) {
							selectedButtonClass = 'btn-success';
						} else {
							selectedButtonClass = 'btn-dark';
						}

						var selectButtonLineID 		= 'select-button-line-id-' + buttonLine;
						var selectButtonLineIDmodal = 'select-button-line-id-modal-' + buttonLine + '_' + buttonCount;

						HTMLlineButtons 		+=	'<button type="button" onclick="setWebserviceSearch(\'' + buttonLine + '\')" style="cursor:default" id="' + selectButtonLineID + '" class="btn ' + selectedButtonClass + ' select-button-line btn-sm mr-1 mb-1">'
												+ 	buttonLine + ' (<b>' + buttonCount + '</b>)'
												+	'</button>'

						HTMLlineButtonsModal 	+=	'<button type="button" onclick="selectGroupValueModal(\'' + buttonLine + '\')" style="width:100px" id="' + selectButtonLineIDmodal + '" class="select-button-line-modal btn btn-primary btn-sm mr-1 mb-1">'
												+ 	buttonLine
												+	'</button>'

					});

					// Reset
					HTMLlineButtons 		+=	'<button type="button" onclick="setWebserviceSearch(\'' + '' + '\')" style="cursor:default" id="' + 'RESET' + '" class="btn ' + 'btn-warning' + ' select-button-line btn-sm mr-1 mb-1">'
											+ 	'<b>' + 'RESET' + '</b>'
											+	'</button>'


					// $('#data-result-button-group').html(HTMLlineButtons);
					// $('#data-result-button-group-modal').html(HTMLlineButtonsModal);

				}
				//=====================================================================================


				return jsonData.data;
			}
		},
		processing: true,
		serverSide: true,
		responsive: true,
		fixedHeader: true,
        order: [[ 0, "asc" ],[ 1, "asc" ]],
		columns:
				[
                    { data: "IPIMPSEQ" }, 	// 0
                    { data: "IPFILENAME" }, // 1
					{ data: "IPFILENMWK" }, // 2
					{ data: "IPLIBRNAME" }, // 3
					{ data: "IPFILEDESC" }, // 4
					{
						// 5
						// Since we are combining multiple data fields, use null as the data source
			            data: null,
			            //data: "IPCPYMAIN",
						render: function (data, type, row, meta)
						{

							IPCPYMAIN = $('#modal-input-IPCPYMAIN').val();
							if ( IPCPYMAIN != '' ) {
								row.IPCPYMAIN = IPCPYMAIN;
							}

							if ( row.IPCPYMAIN == 'Y') {
								var IPCPYMAINtext = '<div class="text-center text-success"><?php echo $datahub_YES ?></div>';
							} else {
								var IPCPYMAINtext = '<div class="text-center text-danger font-weight-bold"><?php echo $datahub_NO ?></div>';
							}

							return IPCPYMAINtext;
						}
					},
					{
						// 6
						// Since we are combining multiple data fields, use null as the data source
			            data: null,
			            //data: "IPCLRMAIN",
						render: function (data, type, row, meta)
						{

							IPCLRMAIN = $('#modal-input-IPCLRMAIN').val();
							if ( IPCLRMAIN != '' ) {
								row.IPCLRMAIN = IPCLRMAIN;
							}

							if ( row.IPCLRMAIN == 'Y') {
								var IPCLRMAINtext = '<div class="text-center text-success"><?php echo $datahub_YES ?></div>';
							} else {
								var IPCLRMAINtext = '<div class="text-center text-danger font-weight-bold"><?php echo $datahub_NO ?></div>';
							}

							return IPCLRMAINtext;
						}
					},
					{
						// 7
						// Since we are combining multiple data fields, use null as the data source
			            data: null,
			            //data: "IPCPYF",
						render: function (data, type, row, meta)
						{

							IPCPYF = $('#modal-input-IPCPYF').val();
							if ( IPCPYF != '' ) {
								row.IPCPYF = IPCPYF;
							}

							if ( row.IPCPYF == 'Y') {
								var IPCPYFtext = '<div class="text-center text-success"><?php echo $datahub_YES ?></div>';
							} else {
								var IPCPYFtext = '<div class="text-center text-danger font-weight-bold"><?php echo $datahub_NO ?></div>';
							}

							return IPCPYFtext;
						}
					},
					{ data: "IPCPYOPT"	},	// 8
					{
						// 9
						// Since we are combining multiple data fields, use null as the data source
			            data: null,
						render: function (data, type, row, meta)
						{

							// Coming from the server program HUB_IMPORT
							RUN_SQL_PGM = $('#modal-input-RUN_SQL_PGM').val();
							if ( RUN_SQL_PGM != '' ) {
								row.RUN_SQL_PGM = RUN_SQL_PGM;
							}


							if ( row.RUN_SQL_PGM == 'Y') {
								var RUN_SQL_PGM_text = '<div class="text-center text-success font-weight-bold"><?php echo $datahub_YES ?></div>';
							} else {
								var RUN_SQL_PGM_text = '<div class="text-center text-danger"><?php echo $datahub_NO ?></div>';
							}

							return RUN_SQL_PGM_text;
						}
					},
					{
						// 10
						// Since we are combining multiple data fields, use null as the data source
			            data: null,
			            //data: "IPACTIV",
						render: function (data, type, row, meta)
						{

							IPACTIV = $('#modal-input-IPACTIV').val();
							if ( IPACTIV != '' ) {
								row.IPACTIV = IPACTIV;
							}

							if ( row.IPACTIV == '1') {
								var IPACTIVtext = '<div class="text-center text-success"><?php echo $datahub_YES ?></div>';
							} else {
								var IPACTIVtext = '<div class="text-center text-danger font-weight-bold"><?php echo $datahub_NO ?></div>';
							}

							return IPACTIVtext;
						}
					},
					{
						// 11
						// Since we are combining multiple data fields, use null as the data source
						data: null,
						render: function (data, type, row, meta)
						{
							// Create edit button
							var myButton = '<button id="edt-' + row.IPFILENAME + '" class="edit-btn btn btn-primary btn-block mr-1"><?php echo $datahub_button_edit ?></button>';
							return myButton;
						}
					},
					{
						// 12
						// Since we are combining multiple data fields, use null as the data source
						data: null,
			            // data: "IPFILENAME",
						render: function (data, type, row, meta)
						{
							// Create delete button
							var myButton = '<button id="dlt-' + row.IPFILENAME + '" class="delete-btn btn btn-danger btn-block mr-1"><?php echo $datahub_button_delete ?></button>';
							return myButton;
						}
					},
                    { data: "IPACTIV" 	}, 	// 13
                    { data: "IPIFSNAME" }, 	// 14
                    { data: "IPIFSDESC" }, 	// 15
					{ data: "IPRUNSQL"	},	// 16
					{ data: "IPSQLWHR"	},	// 17
					{ data: "IPSQLSMT"	},	// 18
					{ data: "IPRUNPGM"	},	// 19
					{ data: "IPPGMWHR"	},	// 20
					{ data: "IPPGMSMT"	},	// 21
					{ data: "IPCGHATT"	},	// 22
					{ data: "IPCPYMAIN" }, 	// 23
                    { data: "IPCLRMAIN" },	// 24
					{ data: "IPCPYF"	},	// 25
					{ data: "IPPATTERN"	}	// 26
                ],
		columnDefs: [

				// Make sure that buttons are not "hided" when responsive kicks in
				{ responsivePriority: 1, targets: 11 },
				{ responsivePriority: 2, targets: 12 },
				{ responsivePriority: 3, targets: 1 },
				{ responsivePriority: 4, targets: 10 },

				// Setup the look and feel of the columns
				{
				"targets": [ 11 ],
				"visible": true,
				"searchable": false,
				 "orderable": false
				},
				{
				"targets": [ 12 ],
				"visible": show_the_delete_button,
				"searchable": false,
				"orderable": false,
				},
				{
				"targets": [ 3,4 ],
				"visible": true,
				"searchable": true,
				"orderable": false
				},
				{
				"targets": [ 5,6,7,8,9 ],
				"visible": true,
				"searchable": false,
				"orderable": false
				},
				{
				"targets": [ 13,14,15,16,17,18,19,20,21,22,23,24,25,26 ],
				"visible": false,
				"searchable": false,
				"orderable": false
				},
				{
				"targets": [ 4 ],
				"className": "text-truncate-dt"  //class to mimic text-truncate in dt
				},
				{
				"targets": [ 0 ],
				"width": '100px',
				"className": "text-align-dt"
				},
				{
				"targets": [ 5,6,7,9 ],
				"width": '60px',
				"className": "text-align-dt"
				}

		],
		pageLength: 10,
		layout: {
			top1Start:
			[{
				pageLength: {
					menu: [10, 25, 50, 100, 250]
				}
			}],
			top1End:
			[{
				search: {
					placeholder: '<?php echo $datahub_datatable_Search_text ?>',
					processing: true
				}
			}],
			topStart: {
				info:{
					 }
			},
			topEnd: {
				paging: {
					buttons: 7,
					firstLast: true,
					boundaryNumbers: true,
				}
			},
			bottomStart: {
				buttons: [
					{
						extend: 'copyHtml5',
						text: '<img src="images/copy.png" height="25"> Copy to Clipboard',
						titleAttr: 'Copy',
						title: 'DATAHUB - Config Data Export - Copy to clipboard',
						exportOptions: {
							// Fields to export (https://datatables.net/reference/button/csv#Examples)
							columns: [0,1,2,3,4,5,6,7,26]
						}

					},
					{
						extend: 'excelHtml5',
						text: '<img src="images/microsoft_excel_logo.png" height="25"> Excel',
						titleAttr: 'Excel',
							title: function(){
								return 'DATAHUB transactions file export';
							},
							filename: function(){
								//var p_id = $('#input-IPFILENAME').val();
								var p_id = moment().format('YYYY-MM-DD HH.mm.ss');
								return 'DATAHUB - Config Data Export - Excel - ' + p_id;
							},
							exportOptions: {
								// Fields to export (https://datatables.net/reference/button/csv#Examples)
								columns: [0,1,2,3,4,5,6,7,26]
							}
					},
					{
						extend: 'pdfHtml5',
						text: '<img src="images/pdf_logo.png" height="25"> PDF',
						titleAttr: 'PDF',
						orientation: 'landscape',
						title: 'DATAHUB - Config Data Export - PDF',
						filename: function(){
								//var p_id = $('#input-IPFILENAME').val();
								var p_id = moment().format('YYYY-MM-DD HH.mm.ss');
								return 'DATAHUB - Config Data Export - Excel - ' + p_id;
						},
						exportOptions: {
							// Fields to export (https://datatables.net/reference/button/csv#Examples)
						columns: [0,1,2,3,4,5,6,7,26],
						modifier: {
							page: 'all'
							}
						}
					}
				]
			},
			bottomEnd: {
				paging: {
					buttons: 7,
					firstLast: true,
					boundaryNumbers: true
				}
			}
		},
		language:
		{
					"decimal":        ",",
					"thousands":      ".",
					"emptyTable":     "<?php echo $datahub_datatable_emptyTable ?>",
					"info":           "<?php echo $datahub_datatable_Info ?>",
					"infoEmpty":      "<?php echo $datahub_datatable_InfoEmpty ?>",
					"InfoFiltered":   "<?php echo $datahub_datatable_InfoFiltered ?>",
					"infoPostFix":    "",
					"lengthMenu":     "<?php echo $datahub_datatable_LengthMenu ?>",
					"loadingRecords": "",
					"processing":     "<?php echo $datahub_datatable_Processing ?>",
					"search":         "<?php echo $datahub_datatable_Search ?>",
					"zeroRecords":    "<?php echo $datahub_datatable_ZeroRecords ?>",
					"paginate":
						{
							"first":    "<?php echo $datahub_datatable_First ?>",
							"last":     "<?php echo $datahub_datatable_Last ?>",
							"next":     "<?php echo $datahub_datatable_Next ?>",
							"previous": "<?php echo $datahub_datatable_Previous ?>"
						},
					"aria": {
						"orderable":  "Order by this column",
						"orderableReverse": "Reverse order this column"
					}

		},
		createdRow: function (row, data, dataIndex) {


		},
		rowCallback: function (row, data, displayNum, displayIndex)
		{

		},
        "preDrawCallback": function(settings)
		{
		},
		"initComplete": function ()
		{


		}

    });


	//=============================================================================
	// Setup the data to be able to update the table without reloading from the server
	//=============================================================================

		// Save the table in a global variable
		thisGlobalTableData = $('#REEFTvisual_data').DataTable();


		// Handle click on "Edit" button
		$('#REEFTvisual_data tbody').on('click', '.edit-btn', function() {
			thisCurrentRow 	= $(this).closest('tr');
			thisGlobalRowData = thisGlobalTableData.row(thisCurrentRow).data();

			// Debug
			// console.log("edit");
			// console.log(thisGlobalRowData);
			//console.log(thisCurrentRow);

			 dataChange();

		});

		// Handle click on "Delete" button
		$('#REEFTvisual_data tbody').on('click', '.delete-btn', function() {
			thisCurrentRow 	= $(this).closest('tr');
			thisGlobalRowData = thisGlobalTableData.row(thisCurrentRow).data();

			// Debug
			// console.log(thisGlobalRowData);
			// console.log(thisCurrentRow);

			dataDeleteConfirm();

		});

	//=============================================================================

	//=============================================================================
	// Place curor in search field
	//=============================================================================
	$('div.dt-search .dt-input').focus();
	//=============================================================================

}

//=============================================================================
// Reason addd  -- not used
//=============================================================================
function dataAdd ( input_pk_type )
{

			var myIPFILENAME = $('#input-IPFILENAME').val();


			resetModalInputFields();
			setModalInputDefaultFields();

			$('#input-mode').val('*add');

			// Reset save field
			save_IPFILENAME = '';


			// Set Yes/No buttons
			set_YES_NO_Button( 'N', 'IPCPYMAIN', 'value' );
			set_YES_NO_Button( 'N', 'IPCLRMAIN', 'value' );
			set_YES_NO_Button( 'Y', 'IPCPYF', 	 'value' );
			set_YES_NO_Button( 'N', 'IPRUNSQL',  'value' );
			set_YES_NO_Button( 'N', 'IPRUNPGM',  'value' );
			set_YES_NO_Button( 'N', 'IPCGHATT',  'value' );
			set_YES_NO_Button( '0', 'IPACTIV',   'bool' );


			// Reset modal message
			resetModalMessage();

			// Remove key fields readonly
			$('#modal-input-IPFILENAME').removeAttr('readonly','readonly');
			$('#data-result-button-group-modal').removeClass('d-none');

			// Show modal
			$('#hub_import_MaintainModal').modal('show');

			// Show notice text
			$('#text-add-notice').removeClass('d-none');

			$('#hub_import_MaintainModal').on('shown.bs.modal', function () {
				$('#modal-input-IPFILENAME').trigger('focus');
			})

}

//=============================================================================
// Show details
//=============================================================================
function dataChange( )
{

	var row = thisGlobalRowData;

	//console.table(row)


	// Save in fields
	var counter     = row["counter"];

	var IPACTIV   		= row["IPACTIV"];
	var IPFILENAME		= row["IPFILENAME"];
	var IPIMPSEQ  		= row["IPIMPSEQ"];
	var IPFILENMWK		= row["IPFILENMWK"];
	var IPLIBRNAME		= row["IPLIBRNAME"];
	var IPFILEDESC		= row["IPFILEDESC"];
	var IPIFSNAME 		= row["IPIFSNAME"];
	var IPIFSDESC 		= row["IPIFSDESC"];
	var IPPATTERN 		= row["IPPATTERN"];
	var IPCPYMAIN 		= row["IPCPYMAIN"];
	var IPCLRMAIN 		= row["IPCLRMAIN"];
	var IPCPYF  		= row["IPCPYF"];
	var IPCPYOPT		= row["IPCPYOPT"];
	var IPRUNSQL		= row["IPRUNSQL"];
	var IPSQLWHR		= row["IPSQLWHR"];
	var IPSQLSMT		= row["IPSQLSMT"];
	var IPRUNPGM		= row["IPRUNPGM"];
	var IPPGMWHR		= row["IPPGMWHR"];
	var IPPGMSMT		= row["IPPGMSMT"];
	var IPCGHATT		= row["IPCGHATT"];
	var RUN_SQL_PGM		= row["RUN_SQL_PGM"];

	$('#input-mode').val('*update');

	save_IPFILENAME =	IPFILENAME;
	save_IPIMPSEQ	=	IPIMPSEQ

	// Move to input fields
	$('#modal-input-counter').val(counter);

	$('#modal-input-IPFILENAME').val( IPFILENAME );

	$('#modal-input-IPACTIV').val( IPACTIV );
	$('#modal-input-IPIMPSEQ').val( IPIMPSEQ );
	$('#modal-input-IPFILENMWK').val( IPFILENMWK );
	$('#modal-input-IPLIBRNAME').val( IPLIBRNAME );
	$('#modal-input-IPFILEDESC').val( IPFILEDESC );
	$('#modal-input-IPIFSNAME').val( IPIFSNAME );
	$('#modal-input-IPIFSDESC').val( IPIFSDESC );
	$('#modal-input-IPPATTERN').val( IPPATTERN );
	$('#modal-input-IPCPYMAIN').val( IPCPYMAIN );
	$('#modal-input-IPCLRMAIN').val( IPCLRMAIN );
	$('#modal-input-IPCPYF').val( IPCPYF );
	$('#modal-input-IPCPYOPT').val( IPCPYOPT );
	$('#modal-input-IPRUNSQL').val( IPRUNSQL );
	$('#modal-input-IPSQLWHR').val( IPSQLWHR );
	$('#modal-input-IPSQLSMT').val( IPSQLSMT );
	$('#modal-input-IPRUNPGM').val( IPRUNPGM );
	$('#modal-input-IPPGMWHR').val( IPPGMWHR );
	$('#modal-input-IPPGMSMT').val( IPPGMSMT );
	$('#modal-input-IPCGHATT').val( IPCGHATT );

	$('#modal-input-RUN_SQL_PGM').val( RUN_SQL_PGM );


	// Check IPACTIVe code
	if ( IPACTIV != '1' && IPACTIV != '0' ) {
		IPACTIV = '1';
	}

	// Set run where
	set_RUN_WHERE( IPSQLWHR, 'IPSQLWHR');
	set_RUN_WHERE( IPPGMWHR, 'IPPGMWHR');

	// Set CpyF options
	setCpyF_option( IPCPYOPT );

	// Set Yes/No buttons
	set_YES_NO_Button( IPCPYMAIN, 	'IPCPYMAIN', 'value' );
	set_YES_NO_Button( IPCLRMAIN, 	'IPCLRMAIN', 'value' );
	set_YES_NO_Button( IPCPYF, 		'IPCPYF', 	 'value' );
	set_YES_NO_Button( IPRUNSQL, 	'IPRUNSQL',  'value' );
	set_YES_NO_Button( IPRUNPGM, 	'IPRUNPGM',  'value' );
	set_YES_NO_Button( IPCGHATT, 	'IPCGHATT',  'value' );
	set_YES_NO_Button( IPACTIV, 	'IPACTIV',   'bool' );


	// Make key fields readonly
	$('#modal-input-IPFILENAME').attr('readonly','readonly');
	$('#data-result-button-group-modal').removeClass('d-none');

	$('.read-only-class').attr('readonly','readonly');

	// Reset modal message
	resetModalMessage();

	// Hide notice text
	$('#text-add-notice').addClass('d-none');


	// Show modal
	$('#hub_import_MaintainModal').modal('show');

	$('#hub_import_MaintainModal').on('shown.bs.modal', function () {
		$('#modal-input-IPIMPSEQ').trigger('focus');
	})

}


//=============================================================================
// Save
//=============================================================================
function dataSave()
{
	// Reset modal message
	resetModalMessage();

	// Check if the is a mark as filename exist, if yes show error
	if ( $('#input-IPFILENAME-exist').val() == 'Y' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0091 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPFILENAME').trigger('focus');
		return false;
	}

	// Check content of fields
	if ( $('#modal-input-IPFILENAME').val() == '' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0088 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPFILENAME').trigger('focus');
		return false;
	}

	if ( $('#modal-input-IPFILENMWK').val() == '' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0090 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPFILENMWK').trigger('focus');
		return false;
	}

	if ( $('#modal-input-IPLIBRNAME').val() == '' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0089 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPLIBRNAME').trigger('focus');
		return false;
	}

	if ( $('#modal-input-IPIFSNAME').val() == '' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0091 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPIFSNAME').trigger('focus');
		return false;
	}

	if ( $('#modal-input-IPPATTERN').val() == '' ) {
		$('#modal-message').addClass('border-bottom').html( '<?php echo $datahub_error0096 ?>' );
		$('#modal-save-button').addClass('disabled').prop("disabled", true);
		$('#modal-input-IPPATTERN').trigger('focus');
		return false;
	}


	var mode = $('#input-mode').val();

	//===============================================================================
	// Remove # if any
	//===============================================================================

		// Setup remove string
		let mySaveString;

		var myWorkField = $('#modal-input-IPFILENMWK').val();
		myWorkField = myWorkField.replace("#", "");
		$('#modal-input-IPFILENMWK').val( myWorkField );

		var myWorkField = $('#modal-input-IPLIBRNAME').val();
		myWorkField = myWorkField.replace("#", "");
		$('#modal-input-IPLIBRNAME').val( myWorkField );


	//===============================================================================

	// Make sure key does not have space and are in uppercase
	// var myWorkField = $('#modal-input-IPFILENAME').val();
	// myWorkField = myWorkField.replace(" ", "_");
	// myWorkField = myWorkField.toUpperCase();
	// $('#modal-input-IPFILENAME').val( myWorkField );

	// Make array and json
	var myData = $('#dataForm').find('input, select, textarea').serializeArray();

	var result = JSON.stringify(myData);

	var result = encodeURIComponent( result );
	// console.log(result);
	// console.log(myData);
	// return;

	var parmData = 'data=' + result
				 + '&mode=' + mode
				 ;

	$.ajax({
		url: "hub_import_maintain_save.php",
		type: "POST",
		data: parmData,
		dataType: "json",
		cache: false,
	})
	.done(function( jsonData ) {


		//=================================================================
		// START - Update the table without doing a server reload
		// Only update
		//=================================================================
		if ( mode == '*update' ) {

			event.preventDefault();

//			var myACTIV = $('#modal-input-ACTIV').val();

			// console.log('myACTIV 1: ' + myACTIV)

			// if ( myACTIV == '1') {
				// myACTIVtext = '<div class="text-center">Yes</div>';
				// myACTIVtext = 'YES';
			// } else {
				// myACTIVtext = '<div class="text-center">No</div>';
				// myACTIVtext = 'NO';
			// }

			// Debug
			// console.log(myGlobalRowData[0]);
			// console.log(myGlobalRowData[1]);
			// console.log(myGlobalRowData[2]);
			// console.log(myCurrentRow);
			// console.table(myGlobalTableData);

			// Get the data for the "Change/Delete button", so we do not need to create it again
			// myChangeButtonData = myGlobalRowData[6];
			// myDeleteButtonData = myGlobalRowData[7];

			//==============================================
			// Use this if you want to update the whole row
			//==============================================
			// myGlobalTableData.row(myCurrentRow).data([
														// modal_input_IPFILENAME,
														// modal_input_LSTCAL,
														// modal_input_IPFILENMWK1,
														// modal_input_IPFILENMWK2,
														// modal_input_COUNT,
														// modal_input_SERTYP,
														// myChangeButtonData,
														// myDeleteButtonData,
														// modal_input_IPFILENMWK1,
														// modal_input_IPFILENMWK2
													// ])
													// .draw(false)
													// ;

			// console.log(thisGlobalTableData.cell(thisCurrentRow,  16 ).data() );
			// console.log(thisGlobalTableData.cell(thisCurrentRow,  19 ).data() );


			//=======================================================
			// Use this if you want to update one or more table cells
			//=======================================================
			thisGlobalTableData.cell(thisCurrentRow,  0  ).data($('#modal-input-IPIMPSEQ').val() );
			thisGlobalTableData.cell(thisCurrentRow,  1  ).data($('#modal-input-IPFILENAME').val() );
			thisGlobalTableData.cell(thisCurrentRow,  2  ).data($('#modal-input-IPFILENMWK').val() );
			thisGlobalTableData.cell(thisCurrentRow,  3  ).data($('#modal-input-IPLIBRNAME').val() );
			thisGlobalTableData.cell(thisCurrentRow,  4  ).data($('#modal-input-IPFILEDESC').val() );
			thisGlobalTableData.cell(thisCurrentRow,  5  ).data($('#modal-input-IPCPYMAIN').val() );
			thisGlobalTableData.cell(thisCurrentRow,  6  ).data($('#modal-input-IPCLRMAIN').val() );
			thisGlobalTableData.cell(thisCurrentRow,  7  ).data($('#modal-input-IPCPYF'	  ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  8  ).data($('#modal-input-IPCPYOPT' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  9  ).data($('#modal-input-RUN_SQL_PGM' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  10 ).data($('#modal-input-IPACTIV').val() );
			// 11 = Edit button
			// 12 = Delete button
			thisGlobalTableData.cell(thisCurrentRow,  13 ).data($('#modal-input-IPACTIV'  ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  14 ).data($('#modal-input-IPIFSNAME').val() );
			thisGlobalTableData.cell(thisCurrentRow,  15 ).data($('#modal-input-IPIFSDESC').val() );
			thisGlobalTableData.cell(thisCurrentRow,  16 ).data($('#modal-input-IPRUNSQL' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  17 ).data($('#modal-input-IPSQLWHR' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  18 ).data($('#modal-input-IPSQLSMT' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  19 ).data($('#modal-input-IPRUNPGM' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  20 ).data($('#modal-input-IPPGMWHR' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  21 ).data($('#modal-input-IPPGMSMT' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  22 ).data($('#modal-input-IPCGHATT' ).val() );

			thisGlobalTableData.cell(thisCurrentRow,  23 ).data($('#modal-input-IPCPYMAIN' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  24 ).data($('#modal-input-IPCLRMAIN' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  25 ).data($('#modal-input-IPCPYF' ).val() );
			thisGlobalTableData.cell(thisCurrentRow,  26 ).data($('#modal-input-IPPATTERN' ).val() );

			//console.log(save_IPIMPSEQ + ' ' + $('#modal-input-IPIMPSEQ').val() );

			// If seq has changed reorder table
			if ( save_IPIMPSEQ != $('#modal-input-IPIMPSEQ').val() ) {
				thisGlobalTableData.draw(false);
			}

		}
		//=================================================================
		// END - Update the table without doing a server reload
		//=================================================================

		//=================================================================
		// Close the modal
		//=================================================================
		$('#hub_import_MaintainModal').modal('hide');

		//=================================================================
		// Only when add
		//=================================================================
		if ( mode == '*add' ) {
			var myButtonID = 'select-button-line-id-' + $('#input-IPFILENAME').val();
			$('#' + myButtonID).click();
			getData('');
		}


	})
	.always(function( jsonData ) {


		// Reset mode
		$('#input-mode').val('');

		// Reset input fields
		resetModalInputFields();


	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( thrownError );
		console.log( xhr );

	});

}

//=============================================================================
// Delete confirm
	//=============================================================================
function dataDeleteConfirm( )
{

	$('#input-mode').val('*delete');

	var row = thisGlobalRowData;

	var input_IPFILENAME = row["IPFILENAME"];

	$('#confirm-delete-IPFILENAME').val(input_IPFILENAME);

	// Create confirm text
	$('#confirm-delete-text-IPFILENAME').html(input_IPFILENAME);

	$('#hub_import_confirmDeleteModal').modal('show');

}

//=============================================================================
// Delete
//=============================================================================
function dataDeleteExec()
{
	// Reset modal message
	resetModalMessage();

	var mode = $('#input-mode').val();

	// Make array and json
	var myData = $('#dataForm-delete').find('input, select').serializeArray();
	var result = JSON.stringify(myData);

	// console.log(result);
	// console.log(myData);
	//return;

	var parmData = 'data=' + result
				 + '&mode=' + mode
				 ;

	$.ajax({
		url: "hub_import_maintain_save.php",
		type: "POST",
		data: parmData,
		dataType: "json",
		cache: false,
	})
	.done(function( jsonData ) {


	$('#hub_import_confirmDeleteModal').modal('hide');

	//=================================================================
	// Only when add
	//=================================================================
	if ( mode == '*delete' ) {
		var myButtonID = 'select-button-line-id-' + $('#input-IPFILENAME').val();
		$('#' + myButtonID).click();

		resetModalInputFields();

		getData('');
	}


	})
	.always(function( jsonData ) {

	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( xhr );

	});

}

//=============================================================================
// Check if userid exists
//=============================================================================
function checkDataExists()
{

	// If not *add, just leave
	if ( $('#input-mode').val() != '*add' ) {
		return false;
	}

	var IPFILENAME = $('#modal-input-IPFILENAME').val();

	// If update, then the "orginal" code is ok
	if ( $('#input-mode').val() == '*update' ) {
		if ( IPFILENAME == save_IPFILENAME ) {
	//		return;
		}
	}

	var parmData = 'ipfilename=' + IPFILENAME
				 ;

	$.ajax({
		url: "hub_impchk_get.php",
		type: "GET",
		data: parmData,
		dataType: "json",
		cache: false,
	})
	.done(function( jsonData ) {

		var returnCode 				= jsonData.header.returnCode;
		var returnMsg 				= jsonData.header.returnMsg;
		var entries_found 			= jsonData.header.entries_found;

		var returnDataValue		 	= jsonData.header.returnDataValue;
		var returnDataValueText		= jsonData.header.returnDataValueText;


		if ( returnDataValue == '50') {
			$('#modal-message').addClass(' border-bottom').html( '<?php echo $datahub_error0091 ?>' );
			$('#modal-save-button').addClass('disabled').prop("disabled", true);
			$('#modal-input-IPFILENAME').trigger('focus');

			// Set mark
			$('#input-IPFILENAME-exist').val('Y');
			return false;
		} else {
			$('#input-IPFILENAME-exist').val('N');
			// IPFILENMWK = jsonData.detail[0].IPFILENMWK
			// $('#modal-input-M1UPP').val( IPFILENMWK );
		}

		// Reset modal message
		resetModalMessage();

	})
	.always(function( jsonData ) {

	})
	.fail(function( xhr, ajaxOptions, thrownError ) {
		console.log('I am failed..');
		console.log( xhr );

	});

}

//=============================================================================
// Show deleted
//=============================================================================
function showDeleted()
{

	var show_deleted = $('#input-show-deleted').val();


	if ( show_deleted == 'Y' ) {
		$('#button-show-deleted').html('<?php echo $datahub_NO ?>');
		$('#input-show-deleted').val('N');
	} else {
		$('#button-show-deleted').html('<?php echo $datahub_YES ?>');
		$('#input-show-deleted').val('Y');
	}


}


//=============================================================================
// Set CpyF option
//=============================================================================
function setCpyF_option( inputValue )
{

	$('.cpy_opt-button').removeClass('btn-success').addClass('btn-primary');

	if ( inputValue == '*ADD' ) {
		$('#button-add-IPCPYOPT').removeClass('btn-primary').addClass('btn-success');
	}

	if ( inputValue == '*REPLACE' ) {
		$('#button-rpl-IPCPYOPT').removeClass('btn-primary').addClass('btn-success');
	}

	if ( inputValue == '*UPDADD' ) {
		$('#button-upd-IPCPYOPT').removeClass('btn-primary').addClass('btn-success');
	}

	$('#modal-input-IPCPYOPT').val(inputValue);

}

//=============================================================================
// Set Yes/No button
//=============================================================================
function set_YES_NO_Button( inputValue, inputID, inputType )
{

	// Bool
	if ( inputType == 'bool' )
	{
		if (inputValue == '')
		{
			inputValue = '0';
		}
	}

	// Value
	if ( inputType == 'value' )
	{
		if (inputValue == '')
		{
			inputValue = 'N';
		}
	}


	var yesID 	= 'button-yes-'  + inputID;
	var noID 	= 'button-no-' 	 + inputID;
	var thisID 	= 'modal-input-' + inputID;


	if ( inputType == 'bool' ) {
		if ( inputValue == '1' ) {
			$('#' + yesID).removeClass('btn-primary').addClass('btn-success');
			$('#' + noID).removeClass('btn-success').addClass('btn-primary');
		} else {
			$('#' + yesID).removeClass('btn-success').addClass('btn-primary');
			$('#' + noID).removeClass('btn-primary').addClass('btn-success');
		}
	}

	if ( inputType == 'value' ) {
		if ( inputValue == 'Y' ) {
			$('#' + yesID).removeClass('btn-primary').addClass('btn-success');
			$('#' + noID).removeClass('btn-success').addClass('btn-primary');
		} else {
			$('#' + yesID).removeClass('btn-success').addClass('btn-primary');
			$('#' + noID).removeClass('btn-primary').addClass('btn-success');
		}
	}

	// Set value for input field
	$('#' + thisID).val(inputValue);

	//------------------------------------------------------------
	// Active button, hide test
	//------------------------------------------------------------
	if ( inputID == 'IPACTIV' ) {
		$('#text-add-notice').addClass('d-none');
		$('#modal-input-IPFILENAME').focus();
	}

	//------------------------------------------------------------

	//------------------------------------------------------------
	// Check RUN SQL/PGM
	//------------------------------------------------------------
	if ( inputID == 'IPRUNSQL' || inputID == 'IPRUNPGM'  ) {

		var a1 = $('#modal-input-IPRUNSQL').val();
		var a2 = $('#modal-input-IPRUNPGM').val();
		if ( a1 == 'Y' || a2 == 'Y' ) {
			$('#modal-input-RUN_SQL_PGM').val( 'Y' );
		} else {
			$('#modal-input-RUN_SQL_PGM').val( 'N' );
		}

		if ( inputID == 'IPRUNSQL' )
		{

			if ( inputValue == 'Y' ) {
				$('.class-IPSQLSMT').removeClass('d-none');
				$('#modal-input-IPSQLSMT').focus();
			} else {
				$('.class-IPSQLSMT').addClass('d-none');
			}
		}

		if ( inputID == 'IPRUNPGM' )
		{

			if ( inputValue == 'Y' ) {
				$('.class-IPPGMSMT').removeClass('d-none');
				$('#modal-input-IPPGMSMT').focus();
			} else {
				$('.class-IPPGMSMT').addClass('d-none');
			}
		}


	}
	//------------------------------------------------------------


}
//=============================================================================
// Run where?
//=============================================================================
function set_RUN_WHERE( inputValue, inputID )
{

	var wrkID 	= 'button-wrk-'  + inputID;
	var mainID 	= 'button-main-' + inputID;
	var inputID = 'modal-input-' + inputID;

	if ( inputValue == '*WRK' ) {
		$('#' + wrkID).removeClass('btn-primary').addClass('btn-success');
		$('#' + mainID).removeClass('btn-success').addClass('btn-primary');
	}
	if ( inputValue == '*MAIN' ) {
		$('#' + wrkID).removeClass('btn-success').addClass('btn-primary');
		$('#' + mainID).removeClass('btn-primary').addClass('btn-success');
	}
	if ( inputValue == '' ) {
		$('#' + wrkID).removeClass('btn-success').addClass('btn-primary');
		$('#' + mainID).removeClass('btn-success').addClass('btn-primary');
	}


	$('#' + inputID).val(inputValue);
}

//=============================================================================
// Set default modal input fields
//=============================================================================
function setModalInputDefaultFields()
{

			var myIPFILENAME = $('#input-IPFILENAME').val();

			$('#modal-input-IPACTIV').val('1');
			$('#modal-input-IPIMPSEQ').val('10');

			$('#modal-input-IPLIBRNAME').val( GLOBAL_CONFIG_RPYIFSLIBR );
			$('#modal-input-IPIFSNAME').val( GLOBAL_CONFIG_RPYIFSPATH );

}

//=============================================================================
// Reset modal input fields
//=============================================================================
function resetModalInputFields()
{

			$('#modal-input-IPFILENAME').val('');

			$('#modal-input-IPACTIV').val('');
			$('#modal-input-IPIMPSEQ').val('');
			$('#modal-input-IPFILENMWK').val('');
			$('#modal-input-IPLIBRNAME').val('');
			$('#modal-input-IPFILEDESC').val('');
			$('#modal-input-IPIFSNAME').val('');
			$('#modal-input-IPIFSDESC').val('');
			$('#modal-input-IPPATTERN').val('');
			$('#modal-input-IPCPYMAIN').val('');
			$('#modal-input-IPCLRMAIN').val('');
			$('#modal-input-IPCPYF').val('');
			$('#modal-input-IPCPYOPT').val('');
			$('#modal-input-IPRUNSQL').val('');
			$('#modal-input-IPSQLWHR').val('');
			$('#modal-input-IPSQLSMT').val('');
			$('#modal-input-IPRUNPGM').val('');
			$('#modal-input-IPPGMWHR').val('');
			$('#modal-input-IPPGMSMT').val('');
			$('#modal-input-IPCGHATT').val('');

			// Reset buttons
			$('#button-reset-IPCPYOPT').click();
			$('#button-reset-IPSQLWHR').click();
			$('#button-reset-IPPGMWHR').click();


			$('#input-mode').val('');

}

//=============================================================================
// Log off
//=============================================================================
function signoff()
{

	window.location.href = "logout.php";

}

//=============================================================================
// Load page
//=============================================================================
function loadPage(url, p1, p2, p3)
{

	window.location.href = url;

}

//=============================================================================
// Reset modal message
//=============================================================================
function resetModalMessage() {

	// Reset
	//$('#modal-message').removeClass('p-2 font-weight-bold border border-danger rounded bg-light').html( '&nbsp;' );

	$('#modal-message').removeClass('border-bottom').html( '&nbsp;' );
	$('#modal-save-button').removeClass('disabled').prop("disabled", false);

}

//=============================================================================
// Clean input string
//=============================================================================
function cleanInputString( myWorkField )
{

	let charactersToRemove = '?#"\'';
	let myPattern = new RegExp('[' + charactersToRemove + ']', 'g');

	myWorkField = myWorkField.replace(myPattern,'');

	return myWorkField;

}

//=============================================================================
// Full screen popup
//=============================================================================
function popUpFull( url, p1, p2, p3 )
{

	var winname = 'win_' + url;

	params  = 'width='+screen.width;
	params += ', height='+screen.height;
	params += ', top=0, left=0'
	params += ', fullscreen=yes';
	params += ',scrollbars=1';

	overview_win = window.open(url,winname, params);
	if (window.focus) {overview_win.trigger('focus')}
	return false;

}

//=============================================================================
// screen popup - center
//=============================================================================
function popUpCenter(url, p1, p2, p3)
{

	var v1_w  = screen.availWidth;
	var v1_h  = screen.availHeight;

	if ( parseInt(v1_w) > 1800 ) {
		v1_w = 1800;
		v1_h = v1_h - 200;
		v1_center = v1_w/0.8;
	}

	// Center popup as good as possible
	var left = (screen.width - v1_w) / 2;
	var top = (screen.height - v1_h) / 4;

	var winname = 'win_' + url;

	params  = 'width='+v1_w;
	params += ', height='+v1_h;
	params += ', top=' + top + ', left=' + left;
	params += ', fullscreen=yes';
	params += ',scrollbars=1';

	overview_win = window.open(url,winname, params);
	if (window.focus) {overview_win.trigger('focus')}
	return false;

}

//=============================================================================
// screen popup - center - bigger
//=============================================================================
function popUpCenterBig(url, p1, p2, p3)
{

	var v1_w  = screen.availWidth;
	var v1_h  = screen.availHeight;

	// Get 25%
	v1_w_pct = v1_w * 0.25;

	v1_w_new = v1_w - v1_w_pct;


	if ( v1_w_new < 1 ) {
		v1_w_new	= 1800;
	}

	v1_w = v1_w_new;
	v1_h = v1_h - 200;
	v1_center = v1_w/0.8;

	// Center popup as good as possible
	var left = (screen.width - v1_w) / 2;
	var top = (screen.height - v1_h) / 4;

	var winname = 'win_' + url;

	params  = 'width='+v1_w;
	params += ', height='+v1_h;
	params += ', top=' + top + ', left=' + left;
	params += ', fullscreen=yes';
	params += ',scrollbars=1';

	overview_win = window.open(url,winname, params);
	if (window.focus) {overview_win.trigger('focus')}
	return false;

}

//=============================================================================
// Popup top
//=============================================================================
function popUpTop(url, p1, p2, p3)
{

	var winname = 'win_' + url;

	w = 650;
	h = 750;

	params  = 'width='+w;
	params += ', height='+h;
	params += ', top=0, left=0'
	params += ', fullscreen=no';
	params += ',scrollbars=1';

	overview_win = window.open(url,winname, params);
	if (window.focus) {overview_win.trigger('focus')}
	return false;
}

//=============================================================================
// Clean input string
//=============================================================================
function cleanInputString( myWorkField )
{

	let charactersToRemove = '?#"\'';
	let myPattern = new RegExp('[' + charactersToRemove + ']', 'g');

	myWorkField = myWorkField.replace(myPattern,'');

	return myWorkField;

}

//=============================================================================
// Set config type
//=============================================================================
function setConfigType( inputType )
{

	outputType = inputType;

	if ( inputType == 'A' ) {
		var outputType = GLOBAL_CONFIG_TYPE_BUTTON_TEXT_A;
	}
	if ( inputType == 'N' ) {
		var outputType = GLOBAL_CONFIG_TYPE_BUTTON_TEXT_N;
	}
	if ( inputType == 'L' ) {
		var outputType = GLOBAL_CONFIG_TYPE_BUTTON_TEXT_L;
	}
	if ( inputType == 'T' ) {
		var outputType = GLOBAL_CONFIG_TYPE_BUTTON_TEXT_T;
	}

	return outputType;

}


//=============================================================================
// Create config type buttons
//=============================================================================
function createConfigTypeButtons()
{

	$('#button-group-config-type').html('');

	// Char
	myConfigType_A = '<button type="button" id="button-config_type-button-A" class="btn btn-primary btn-config-type mr-1 mb-1" onclick="selectConfigType(\'A\')">' + GLOBAL_CONFIG_TYPE_BUTTON_TEXT_A +'</button>';
	myConfigType_N = '<button type="button" id="button-config_type-button-N" class="btn btn-primary btn-config-type mr-1 mb-1" onclick="selectConfigType(\'N\')">' + GLOBAL_CONFIG_TYPE_BUTTON_TEXT_N +'</button>';
	myConfigType_L = '<button type="button" id="button-config_type-button-L" class="btn btn-primary btn-config-type mr-1 mb-1" onclick="selectConfigType(\'L\')">' + GLOBAL_CONFIG_TYPE_BUTTON_TEXT_L +'</button>';
	myConfigType_T = '<button type="button" id="button-config_type-button-T" class="btn btn-primary btn-config-type mr-1 mb-1" onclick="selectConfigType(\'T\')">' + GLOBAL_CONFIG_TYPE_BUTTON_TEXT_T +'</button>';

	$('#button-group-config-type').html(
										myConfigType_A +
										myConfigType_N +
										myConfigType_L +
										myConfigType_T
									   );

}

//=============================================================================
// Select config type
//=============================================================================
function selectConfigType( inputType )
{

	$('#modal-input-M1UPP').val( inputType );


	// Remove all "active" marks
	$('.btn-config-type').removeClass('active btn-success').addClass('btn-primary');;

	// Mark button as selected
	myID = 'button-config_type-button-' + inputType;
	$('#' + myID ).addClass('active btn-success').removeClass('btn-primary');

}

//=============================================================================
// Select line modal
//=============================================================================
function selectGroupValueModal( inputLine )
{

	$('#modal-input-IPFILENAME').val( inputLine );

	var selectButtonLineID = 'select-button-line-id-modal-' + inputLine;

	$('.select-button-line-modal').removeClass('btn-success').addClass('btn-primary');
	$('#' + selectButtonLineID).removeClass('btn-primary').addClass('btn-success');

	// Place cursor
	$('#modal-input-IPFILENAME').trigger('focus');
	resetModalMessage();

}

//=============================================================================
// Reset line modal
//=============================================================================
function resetLineModal()
{

	resetModalMessage()

	let inputLine = $('#modal-input-IPFILENAME').val();

	if ( inputLine == '' ) {
		$('.select-button-line-modal').removeClass('btn-success').addClass('btn-primary');
	}

}

//=============================================================================
// Set action type
//=============================================================================
function setActionType( inputType )
{

	outputType = '';

	if ( inputType == '*PDF' ) {
		outputType = '1';
	}
	if ( inputType == '*PIC' ) {
		outputType = '2';
	}
	if ( inputType == '*SCAN' ) {
		outputType = '3';
	}
	if ( inputType == '*MOVIE' ) {
		outputType = '4';
	}
	if ( inputType == '*LINK' ) {
		outputType = '5';
	}
	if ( inputType == '*CHECK' ) {
		outputType = '6';
	}

	return outputType;

}

//=============================================================================
// Open previewer
//=============================================================================
function preViewElement( myElement )
{

	let h = $(window).height();
	let w = $(window).width();

	console.log('h: ' + h + ' -- ' + 'w: ' + w);

	h = h * 0.75;

	console.log('h: ' + h + ' -- ' + 'w: ' + w);


	// Create ID
	let myID = '#' + myElement;
	let myURL = $( myID ).val();
	let myIFRAME = '<iframe style="height:' + h + 'px;width:100%;" src=' + myURL +'></iframe>';


	// Set iframe
	$('#modal-preview-iframe').html( myIFRAME );

	// Show modal
	$('#hub_import_previewModal').modal('show');

}

//=============================================================================
// Get data - search
//=============================================================================
function setWebserviceSearch( input_IPFILENAME )
{

	// Save curreent webservice name
	$('#input-IPFILENAME').val( input_IPFILENAME );

	var selectButtonLineID 		= 'select-button-line-id-' + input_IPFILENAME;

	// Set clicked button
	$('.select-button-line').removeClass('btn-success').addClass('btn-dark');
	$('#' + selectButtonLineID).removeClass('btn-dark').addClass('btn-success');

	// Clear table - note the draw will occur in the getData function
	$('#REEFTvisual_data').DataTable().clear();
	getData();

	//=============================================================================
	// Place curor in search field
	//=============================================================================
	$('div.dt-search .dt-input').focus();
	//=============================================================================


}

//=============================================================================
// Close modal
//=============================================================================
function closeModal() {


	$('#hub_import_MaintainModal').modal('hide');

}

//=============================================================================
// Set clock
//=============================================================================
function updateClock() {

	var currentTime = moment().format('YYYY-MM-DD HH:mm:ss');
	currentTime = REEFT_format_date( currentTime, DFT_DATE_DISPLAY_FORMAT )

	$('#input-current-date').val( moment().format('YYYY-MM-DD') );
	$('#input-current-time').val( moment().format('HH:mm:ss') );


	$('#current-time').html( currentTime );

	// If add mode update date/time in modal window
	if ( $('#input-mode').val() == '*add' )
	{

		$('#modal-input-M1VLT').val( $('#input-current-date').val() );
		$('#modal-input-M3HTZ').val( $('#input-current-time').val() );

	}

}

//=============================================================================
// jQuery - Ready
//=============================================================================
$(document).ready(function()
{

	// When closing modal
	$('#hub_import_MaintainModal').on('hidden.bs.modal', function (e) {
		resetModalInputFields();
	})


	// Do not show deleted
	$('#input-show-deleted').val('Y');
	$('#input-IPFILENAME-exist').val('N');


	// Get data done by datatables
	setDataTables();

	$('#delay-marker-id').html('<i id="delay-marker-icon-id" class="text-success fa-solid fa-circle"></i>');

	//-----------------------------------------------------------------------
	// Start the clock
	//-----------------------------------------------------------------------
		updateClock();
		setInterval(function() {
			updateClock();
		}, 1000); 
	//-----------------------------------------------------------------------
	

	//-----------------------------------------------------------------------
	// Set font awesome icon type
	//-----------------------------------------------------------------------
	// Value is from config/config.php
	var iconType = '<?php echo $DFT_SET_FONT_AWESOME_ICON_TYPE ?>';
	setFontAwesomeIconType( iconType );
	//-----------------------------------------------------------------------

	//-----------------------------------------------------------------------
	// Delay keyup checker
	//-----------------------------------------------------------------------
	var delay = (function () {
		var timer = 0;
		return function (callback, ms) {
			clearTimeout(timer);
			timer = setTimeout(callback, ms);
		};
	})()


	// DataTable search delay
	$('#REEFTvisual_data_wrapper div.dt-search .dt-input')
    .unbind() // overrule normal behavior
    .bind('keyup', function(e){

		$('#delay-marker-icon-id').removeClass('text-success').addClass('text-danger');

		var inputValue = $('#REEFTvisual_data_wrapper div.dt-search .dt-input').val();
		var currSearchValue = $('#input-search-line').val();

		if (inputValue != currSearchValue) {
			$('#input-search-line').val( inputValue );
			//If enter or delete we update immediately, consider to add backspace=8 and delete=46 also
			const keyList = [13];
			if (keyList.includes(e.keyCode)) {
				// console.log('immediately ' + inputValue );
				$('#delay-marker-icon-id').removeClass('text-danger').addClass('text-success');
				thisGlobalTableData.search(inputValue).draw(); // fire in the hole
			} else {
				delay(function () {
					// console.log('this will hit, once user has not typed for 1 second ' + inputValue );
					$('#delay-marker-icon-id').removeClass('text-danger').addClass('text-success');
					thisGlobalTableData.search(inputValue).draw(); // fire in the hole
				}, 0800);
			}
		}
	});


	//-----------------------------------------------------------------------
	// Check exists
	//-----------------------------------------------------------------------
	let $filter01 = $('#modal-input-IPFILENAME');
	$filter01.on('keyup', function () {
		delay(function () {
			var inputValue = $('#modal-input-IPFILENAME').val();
			if ( inputValue != '') {
				console.log('this will hit, once user has not typed for 1 second ' + inputValue );
				checkDataExists();
			}
		}, 0800);
	});


	//-----------------------------------------------------------------------
	// Event listener for the update button
	//-----------------------------------------------------------------------
    $('#updateButton').on('click', function() {


        // Trigger a redraw of the table
        thisGlobalTableData.draw();
    });


	//-----------------------------------------------------------------------
	// Set short cuts
	//-----------------------------------------------------------------------

	// If add d-none class, do not add shortcut
	if ( GLOBAL_ADD_ALLOWED == 'Y' ) {
		shortcut.add("Alt+F6",function() {
			$('#add-button').click();
		});

		// Show add button
		$('#add-button').removeClass('d-none');
	}


	// Close window
	shortcut.add("Shift+Esc",function() {
		$('#button-close').click();
	});


});
// -->
</script>

</head>

<body>

<div class="container-fluid mt-2 pl-3 pr-3">

		<input type="text" class="d-none" id="input-IPFILENAME-exist">

		<input type="text" class="d-none" id="input-IPFILENAME">
		<input type="text" class="d-none" id="input_search">
		<input type="text" class="d-none" id="input-save-seq">

		<input type="text" class="d-none" id="input-mode">
		<input type="text" class="d-none" id="input-current-date">
		<input type="text" class="d-none" id="input-current-time">

		<input type="text" class="d-none" id="input-show-deleted" >
		<input type="text" class="d-none" id="input-search-line">
		<input type="text" class="d-none" id="input-filter-line">

		<input type="text" class="d-none" id="input-rpyOffSet">
		<input type="text" class="d-none" id="input-rpyTotalRecordsFound">
		<input type="text" class="d-none" id="input-rpyTotalPages">
		<input type="text" class="d-none" id="input-rpyPageSize">

		<div class="row">
			<div class="col-2">
				<img src="images/customer-logo.png" alt="Customer Logo">
			</div>
			<div class="col-8 text-center <?php echo $DFT_CLOCK_SIZE ?>">
				<i class="font-awesome-pseudo-class fa-thin fa-clock"></i>&nbsp;&nbsp;<span id="current-time"><?php echo date('d-m-Y h:i:s') ?></span>
			</div>
			<div class="col-2 text-right">

				<div class="btn btn-primary mb-1" onclick="loadPage('menu_admin.php','','','')" title="<?php echo $datahub_go_to_my_dear_home ?>"><i class="font-awesome-pseudo-class fa-2x fa-thin fa-home"></i></div>

				<div class="d-none">
					<div class="btn btn-primary mb-1 d-none d-xl-inline-block" onclick="loadPage('menu_admin.php','','','')" title="<?php echo $datahub_go_to_my_dear_home_03 ?>"><i class="font-awesome-pseudo-class fa-2x fa-thin fa-fort"></i></div>
					<div class="btn btn-danger mb-1 d-none d-lg-inline-block"  onclick="signoff()" title="<?php echo $datahub_go_to_my_dear_home_02 ?>"><i class="font-awesome-pseudo-class fa-thin  fa-2x fa-right-from-bracket"></i></div>
				</div>

			</div>
		</div>

		<div class="row">
			<div class="col-12 text-center">
				<div id="data-hub-company-information"></div>
			</div>
		</div>


		<div class="card mt-2">
			<div class="card-header text-muted">
				<div class="row mt-2">
					<div class="col-4 h4">
						<i class="font-awesome-pseudo-class fa-thin fa-file-import"></i> <?php echo "$datahub_text0005"; ?>
					</div>
					<div class="col text-right font-weight-bold">
						<button type="button" class="d-none btn btn-dark" id="button-toggle-show-deleted" title="Alt+F2=Toggle" onclick="showDeleted()"><?php echo $datahub_button_show_also_deleted ?> : <span id="button-show-deleted" class="font-weight-bold"><?php echo $datahub_YES ?></span></button>

							<div class="row d-none">
								<div class="col-10 text-right">
								</div>
								<div class="col text-right">
									<?php echo $datahub_text0059 ?> <span id="text-current-page">...</span> <?php echo $datahub_text0060 ?> <span id="text-total-pages">...</span>
								</div>
							</div>

							<div class="row">
								<div class="col-10 text-right">
								</div>
								<div class="col text-right">
									<?php echo $datahub_text0061 ?> : <span id="text-total-records-found">...</span>
								</div>
							</div>

							<div class="row">
								<div class="col-10 text-right">
								</div>
								<div class="col text-right">
										<span id="delay-marker-id"></span>
								</div>
							</div>



					</div>
				</div>
			</div>

			<div class="card-body">

						<!-- Message if screen is not wide enough -->
				<div class="container-fluid mt-2 mb-4 d-block d-lg-none">
					<div id="general-message-top" class="border border-danger rounded p-2 text-danger font-weight-boldx"><?php echo $datahub_error0040a ?></div>
				</div>
			<!-- Message if screen is not wide enough -->

				<!-- Group lines found -->
				<div class="d-none d-lg-block">
					<div class="row mb-2">
						<div class="col-12">
							<div id="data-result-button-group"></div>
						</div>
					</div>
				</div>


				<div class="row mt-2">
					<div class="col">
						<div id="data-result" style="width: 100%;"></div>
							<table id="REEFTvisual_data" class="table nowrap table-bordered table-striped table-hover">
								<thead>
									<tr class="bg-primary text-white font-weight-bold text-center">
										<th class="text-center"><?php echo $datahub_text0007 ?></th>
										<th class="text-left"><?php echo $datahub_text0003 ?></th>
										<th class="text-left"><?php echo $datahub_text0008 ?></th>
										<th class="text-left"><?php echo $datahub_text0009 ?></th>
										<th class="text-left"><?php echo $datahub_text0010 ?></th>
										<th class="text-center"><?php echo $datahub_text0014a ?></th>
										<th class="text-center"><?php echo $datahub_text0015a ?></th>
										<th class="text-center"><?php echo $datahub_text0162a ?></th>
										<th class="text-left"><?php echo $datahub_text0013a ?></th>
										<th class="text-left"><?php echo $datahub_text0164 ?></th>
										<th class="text-center"><?php echo $datahub_text0163 ?></th>
										<th class="text-left"><button type="button" id="add-button" title="Shortcut: Alt+F6" onclick="dataAdd('0')" class="d-none btn btn-dark btn-block font-weight-bold"><?php echo $datahub_button_save_01 ?></button></th>
										<th class="text-left"></th>
										<th class="text-left">IPACTIV</th>
										<th class="text-left">IPIFSNAME</th>
										<th class="text-left">IPIFSDESC</th>
										<th class="text-left">IPRUNSQL</th>
										<th class="text-left">IPSQLWHR</th>
										<th class="text-left">IPSQLSMT</th>
										<th class="text-left">IPRUNPGM</th>
										<th class="text-left">IPPGMWHR</th>
										<th class="text-left">IPPGMSMT</th>
										<th class="text-left">IPCGHATT</th>
										<th class="text-left">IPCPYF</th>
										<th class="text-left"></th>
										<th class="text-left"></th>
										<th class="text-left"><?php echo $datahub_text0221 ?></th>

									</tr>
								</thead>
							</table>

					</div>
				</div>


				<div class="row">
					<div class="col text-right mb-2">
						<small><div id="load-time-from-database"></div></small>
					</div>
				</div>

			</div>

		</div>

</div>


<!-- Set footer -->
<?php
	include "include/footer.php";
?>
<!-- Set footer -->

<!-- ========================================================================== -->
<!--                                M O D A L S                                 -->
<!-- ========================================================================== -->

<!-- Modal start -->
<div class="modal fade" id="hub_import_MaintainModal" tabindex="-1" data-backdrop="static" role="dialog" aria-labelledby="hub_import_MaintainModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-xxl">
    <div class="modal-content">

      <div class="modal-header bg-primary text-white">

		<div class="container-fluid pl-0 pr-0">
		<div class="row">

			<div class="col-8">
				<h5 class="modal-title" id="hub_import_MaintainModalLabel"><i class="font-awesome-pseudo-class fa-thin fa-file-import"></i> <?php echo $datahub_text0005 ?></h5>
			</div>

			<div class="col text-right">

			</div>
			<div class="col-1 text-right" style="max-width:20px">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				  <span aria-hidden="true">&times;</span>
				</button>
			</div>

		</div>
		</div>


      </div>
      <div class="modal-body ml-2 mr-2">

  		<input type="text" class="d-none" id="input-current-color-picker">
		<input type="text" class="d-none" id="input-current-text-color">
		<input type="text" class="d-none" id="input-current-background-color">

			<!-- Message if screen is not wide enough -->
				<div class="container-fluid mt-2 mb-4 d-block d-lg-none">
					<div id="general-message-top" class="border border-danger rounded p-2 text-danger font-weight-boldx"><?php echo $datahub_error0040a ?></div>
				</div>
			<!-- Message if screen is not wide enough -->


			<form name="dataForm" id="dataForm">

			<!-- Hidden fields start -->

			<!-- Hidden fields end -->

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0006 ?>
				</div>
				<div class="col-5">
					<button type="button" onclick="set_YES_NO_Button('1','IPACTIV','bool')" class="btn btn-primary" id="button-yes-IPACTIV"><?php echo $datahub_YES ?></button>
					<button type="button" onclick="set_YES_NO_Button('0','IPACTIV','bool')" class="btn btn-primary" id="button-no-IPACTIV"><?php echo $datahub_NO ?></button>
					<input class="form-control d-none" type="text" id="modal-input-IPACTIV"    name="modal-input-IPACTIV" 	onkeyup="resetModalMessage()">
					<span id="text-add-notice" class="d-none">&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size:20px"><i class="fa-1x fa-duotone fa-solid fa-circle-left" style="--fa-secondary-opacity: 1.0; --fa-primary-color: forestgreen; --fa-secondary-color: gold;" ></i></span> <?php echo $datahub_text0165 ?></span>
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0007a ?>
				</div>
				<div class="col-2">
					<input class="form-control" type="number" min="1" step="10" id="modal-input-IPIMPSEQ" name="modal-input-IPIMPSEQ" onkeyup="resetModalMessage()">
				</div>
			</div>


			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0003 ?> / <?php echo $datahub_text0010 ?>
				</div>
				<div class="col-3">
					<input class="form-control" type="text" id="modal-input-IPFILENAME" name="modal-input-IPFILENAME" onkeyup="resetModalMessage()">
				</div>
				<div class="col-4">
					<input class="form-control" type="text" id="modal-input-IPFILEDESC" name="modal-input-IPFILEDESC" onkeyup="resetModalMessage()">
				</div>

			</div>

			<div class="row mt-2">
				<div class="col-3">
				<?php echo $datahub_text0008 ?>
				</div>
				<div class="col-3">
					<input class="form-control" type="text" id="modal-input-IPFILENMWK" name="modal-input-IPFILENMWK" onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-1">
				<div class="col-3">
					<?php echo $datahub_text0009 ?>
				</div>
				<div class="col-3">
					<input class="form-control" type="text" id="modal-input-IPLIBRNAME" name="modal-input-IPLIBRNAME"  	onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-1">
				<div class="col-3">
					<?php echo $datahub_text0011 ?> / <?php echo $datahub_text0012 ?>
				</div>
				<div class="col-3">
					<input class="form-control" type="text" id="modal-input-IPIFSNAME"  name="modal-input-IPIFSNAME"  	onkeyup="resetModalMessage()">
				</div>
				<div class="col-4">
					<input class="form-control" type="text" id="modal-input-IPIFSDESC"  name="modal-input-IPIFSDESC" onkeyup="resetModalMessage()">
				</div>
			</div>
			
			<div class="row mt-1">
				<div class="col-3">
					<?php echo $datahub_text0221 ?> 
				</div>
				<div class="col-3">
					<input class="form-control" type="text" id="modal-input-IPPATTERN"  name="modal-input-IPPATTERN"  	onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-1">
				<div class="col-3">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0014 ?>
				</div>
				<div class="col-2">
					<button type="button" onclick="set_YES_NO_Button('Y','IPCPYMAIN','value')" class="btn btn-primary" id="button-yes-IPCPYMAIN"><?php echo $datahub_YES ?></button>
					<button type="button" onclick="set_YES_NO_Button('N','IPCPYMAIN','value')" class="btn btn-primary" id="button-no-IPCPYMAIN"><?php echo $datahub_NO ?></button>
					<input class="form-control d-none" type="text" id="modal-input-IPCPYMAIN"  name="modal-input-IPCPYMAIN"  	onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0015 ?>
				</div>
				<div class="col-2">
					<button type="button" onclick="set_YES_NO_Button('Y','IPCLRMAIN','value')" class="btn btn-primary" id="button-yes-IPCLRMAIN"><?php echo $datahub_YES ?></button>
					<button type="button" onclick="set_YES_NO_Button('N','IPCLRMAIN','value')" class="btn btn-primary" id="button-no-IPCLRMAIN"><?php echo $datahub_NO ?></button>
					<input class="form-control d-none" type="text" id="modal-input-IPCLRMAIN"  name="modal-input-IPCLRMAIN"  	onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0162 ?>
				</div>
				<div class="col-2">
					<button type="button" onclick="set_YES_NO_Button('Y','IPCPYF','value')" class="btn btn-primary" id="button-yes-IPCPYF"><?php echo $datahub_YES ?></button>
					<button type="button" onclick="set_YES_NO_Button('N','IPCPYF','value')" class="btn btn-primary" id="button-no-IPCPYF"><?php echo $datahub_NO ?></button>
					<input class="form-control d-none" type="text" id="modal-input-IPCPYF" 	name="modal-input-IPCPYF" 		onkeyup="resetModalMessage()">
				</div>
			</div>

			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0013 ?>
				</div>
				<div class="col-5">
					<button type="button" onclick="setCpyF_option('*ADD')" 		class="btn btn-primary cpy_opt-button" id="button-add-IPCPYOPT">*ADD</button>
					<button type="button" onclick="setCpyF_option('*REPLACE')" 	class="btn btn-primary cpy_opt-button" id="button-rpl-IPCPYOPT">*REPLACE</button>
					<button type="button" onclick="setCpyF_option('*UPDADD')" 	class="btn btn-primary cpy_opt-button" id="button-upd-IPCPYOPT">*UPDADD</button>
					<button type="button" onclick="setCpyF_option('')" 			class="btn btn-warning               " id="button-reset-IPCPYOPT">Reset</button>
					<input class="form-control d-none" type="text" id="modal-input-IPCPYOPT" name="modal-input-IPCPYOPT" onkeyup="resetModalMessage()">
				</div>
			</div>


			<div class="row mt-2 border border-primary">
				<div class="col-12">

					<div class="row">
						<div class="col-3">&nbsp;</div>
						<div class="col-2">&nbsp;</div>
						<div class="col-5">
						<small class="font-weight-bold class-IPSQLSMT d-none"><?php echo $datahub_text0018 ?></small>
						</div>
					</div>

					<div class="row mt-2">
						<div class="col-3">
							<?php echo $datahub_text0016 ?>
						</div>
						<div class="col-2">
							<button type="button" onclick="set_YES_NO_Button('Y','IPRUNSQL','value')" class="btn btn-primary" id="button-yes-IPRUNSQL"><?php echo $datahub_YES ?></button>
							<button type="button" onclick="set_YES_NO_Button('N','IPRUNSQL','value')" class="btn btn-primary" id="button-no-IPRUNSQL"><?php echo $datahub_NO ?></button>
							<input class="form-control d-none" type="text" id="modal-input-IPRUNSQL" 	name="modal-input-IPRUNSQL" 	onkeyup="resetModalMessage()">
						</div>

						<div class="col-5">
							<input class="form-control class-IPSQLSMT d-none" type="text" id="modal-input-IPSQLSMT" 	name="modal-input-IPSQLSMT" 	onkeyup="resetModalMessage()">
						</div>
					</div>

					<div class="row mt-2 mb-2">
						<div class="col-3">
							<?php echo $datahub_text0017 ?>
						</div>
						<div class="col-4">
							<button type="button" onclick="set_RUN_WHERE( '*WRK', 'IPSQLWHR' )" class="btn btn-primary" id="button-wrk-IPSQLWHR">*WRK</button>
							<button type="button" onclick="set_RUN_WHERE( '*MAIN', 'IPSQLWHR' )" class="btn btn-primary" id="button-main-IPSQLWHR">*MAIN</button>
							<button type="button" onclick="set_RUN_WHERE( '', 'IPSQLWHR' )" class="btn btn-warning" id="button-reset-IPSQLWHR">Reset</button>
							<input class="form-control d-none" type="text" id="modal-input-IPSQLWHR" 	name="modal-input-IPSQLWHR"	onkeyup="resetModalMessage()">
						</div>
					</div>

			</div>
			</div>

			<div class="row mt-2 border border-primary">
				<div class="col-12">

					<div class="row">
						<div class="col-3">&nbsp;</div>
						<div class="col-2">&nbsp;</div>
						<div class="col-5">
						<small class="font-weight-bold class-IPPGMSMT d-none"><?php echo $datahub_text0021 ?></small>
						</div>
					</div>

					<div class="row mt-2">
						<div class="col-3">
							<?php echo $datahub_text0019 ?>
						</div>
						<div class="col-4">
							<button type="button" onclick="set_YES_NO_Button('Y','IPRUNPGM','value')" class="btn btn-primary" id="button-yes-IPRUNPGM"><?php echo $datahub_YES ?></button>
							<button type="button" onclick="set_YES_NO_Button('N','IPRUNPGM','value')" class="btn btn-primary" id="button-no-IPRUNPGM"><?php echo $datahub_NO ?></button>
							<input class="form-control d-none" type="text" id="modal-input-IPRUNPGM" 	name="modal-input-IPRUNPGM"	onkeyup="resetModalMessage()">
							<input class="form-control d-none" type="text" id="modal-input-RUN_SQL_PGM" name="modal-input-RUN_SQL_PGM">
						</div>

						<div class="col-5">
							<input class="form-control class-IPPGMSMT d-none" type="text" id="modal-input-IPPGMSMT" 	name="modal-input-IPPGMSMT"	onkeyup="resetModalMessage()">
						</div>
					</div>


					<div class="row mt-2 mb-2">
						<div class="col-3">
							<?php echo $datahub_text0020 ?>
						</div>
						<div class="col-4">
							<button type="button" onclick="set_RUN_WHERE( '*WRK', 'IPPGMWHR' )" class="btn btn-primary" id="button-wrk-IPPGMWHR">*WRK</button>
							<button type="button" onclick="set_RUN_WHERE( '*MAIN', 'IPPGMWHR' )" class="btn btn-primary" id="button-main-IPPGMWHR">*MAIN</button>
							<button type="button" onclick="set_RUN_WHERE( '', 'IPPGMWHR' )" class="btn btn-warning" id="button-reset-IPPGMWHR">Reset</button>
							<input class="form-control d-none" type="text" id="modal-input-IPPGMWHR" 	name="modal-input-IPPGMWHR"	onkeyup="resetModalMessage()">
						</div>
					</div>

				</div>
			</div>


			<div class="row mt-2">
				<div class="col-3">
					<?php echo $datahub_text0161 ?>
				</div>
				<div class="col-5">
					<button type="button" onclick="set_YES_NO_Button('Y','IPCGHATT','value')" class="btn btn-primary" id="button-yes-IPCGHATT"><?php echo $datahub_YES ?></button>
					<button type="button" onclick="set_YES_NO_Button('N','IPCGHATT','value')" class="btn btn-primary" id="button-no-IPCGHATT"><?php echo $datahub_NO ?></button>
					<input class="form-control d-none" type="text" id="modal-input-IPCGHATT" 	name="modal-input-IPCGHATT"	onkeyup="resetModalMessage()">
				</div>
			</div>

			</form>

      </div>
      <div class="modal-footer-pretty modal-footer">

			<div class="container-fluid">

				<div class="row">
					<div class="col-12 text-left">
						<div class="p-1 font-weight-bold text-danger border-top border-dark " id="modal-message">&nbsp;</div>
					</div>
				</div>

				<div class="row mt-1 mb-2">
					<div class="col-3 text-left">
						<button type="button" id="modal-save-button" class="btn btn-primary btn-block" onclick="dataSave()"><?php echo $datahub_button_save ?></button>
					</div>
					<div class="col-6 text-right">
					</div>
					<div class="col-3 text-right">
						<button type="button" class="btn btn-primary btn-block" data-dismiss="modal"><?php echo $datahub_button_cancel_01 ?></button>
					</div>
				</div>

			</div>


      </div>
    </div>
  </div>
</div>

<!-- Modal end -->


<!-- ************************************************ -->
<!--                 Confirm delete                   -->
<!-- ************************************************ -->
<div class="modal fade" id="hub_import_confirmDeleteModal" tabindex="-1" role="dialog" aria-labelledby="hub_import_confirmDeleteModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-xl" role="document">
    <div class="modal-content">
      <div class="modal-header bg-primary text-white">
        <h5 class="modal-title" id="hub_import_confirmDeleteModalLabel"><?php echo $datahub_text0063 ?></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">

		<form name="dataForm-delete" id="dataForm-delete">

			<input type="text" class="d-none" id="confirm-delete-IPFILENAME" name="confirm-delete-IPFILENAME">

		</form>

		<div class="h6"><?php echo $datahub_text0062 ?>: <span class="font-weight-bold" id="confirm-delete-text-IPFILENAME"></span></div>

      </div>
      <div class="modal-footer">

			<div class="container-fluid">

				<div class="row mt-1 mb-2">
					<div class="col-3 text-left">
						<button type="button" onclick="dataDeleteExec()" class="btn btn-primary"><?php echo $datahub_button_delete ?></button>
					</div>
					<div class="col-6 text-right">
					</div>
					<div class="col-3 text-right">
						<button type="button" class="btn btn-primary" data-dismiss="modal"><?php echo $datahub_button_cancel ?></button>
					</div>
				</div>


			</div>
      </div>
    </div>
  </div>
</div>


</body>
</html>